package com.bridgeintelligent.tag.customer.mapper;

import com.bridgeintelligent.tag.customer.entity.Issue;
import com.bridgeintelligent.tag.customer.model.IssueQueryModel;
import com.bridgeintelligent.tag.customer.pojo.Customers;
import com.bridgeintelligent.tag.customer.vo.IssueVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @description
 * @author: grp 2021-02-23 14:49
 **/
@Mapper
public interface IssueMapper {
    int add(Issue channel);

    List<IssueVO> findList(IssueQueryModel model);

    int update(Issue channel);

    int updateApproveInfo(Issue channel);

    @Delete("delete from TAG_CUSTOMERS_ISSUE where id = #{id}")
    int deleteById(String id);

    IssueVO findOne(String id);

    @Select("select count(1) from TAG_CUSTOMERS_ISSUE where issue_name = #{name} and is_del = '00'")
    int countByName(String name);

    @Select("select count(1) from TAG_CUSTOMERS_ISSUE where issue_key = #{id} and is_del = '00'")
    int countById(String id);

    @Select("select count(1) from TAG_CUSTOMERS_ISSUE where issue_name = #{name} and issue_key <> #{id} and is_del = '00'")
    int countByNameAndNotId(String name, String id);

    List<Customers> findCustomers();

    List<IssueVO> findCusApproveList(Map map);

    @Select("select id from TAG_CUSTOMERS_ISSUE where instance_id = #{instanceId}")
    Issue findByInstanceId(String instanceId);
}
